<template>
    <template v-for="(item, index) in options">
        <template v-if="values.includes(item.value)">
            <span v-if="item.dataType === 'default' || item.dataType === ''" :key="item.value" :index="index"
                  :class="item.cssClass">{{item.label}}</span>
            <el-tag v-else :type="item.dataType" :key="item.value" :index="index" :class="item.cssClass"
                    :disable-transitions="true">{{item.label}}</el-tag>
        </template>
    </template>
</template>

<script setup>
import {computed} from "vue";

const props = defineProps({
    //数据集合
    options: {
        type: Array,
        default: null
    },
    //值
    value: [String, Number, Array]
})

const values = computed(() => {
    if (props.value !== null && typeof props.value !== 'undefined') {
        return Array.isArray(props.value) ? props.value : [String(props.value)]
    } else {
        return [];
    }
})

</script>

<style scoped>

</style>